home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 2 / ETO Development Tools 2.iso / Tools - Objects / Virtual User 1.0b5 / Example Scripts / HierarchicalExample.vu < prev    next >
Encoding:
Text File  |  1990-10-05  |  2.0 KB  |  72 lines  |  [TEXT/MPS ]

  1. #
  2. #    File         HierarchicalExample.vu 
  3. #
  4. #    Contains:    An example of selecting menuitems which belong to submenus
  5. #                Prerequisite : AppleLink application with Help enabled (should
  6. #                have the help file) should be launched and be the frontmost app.
  7. #                Get rid of the login dialog, either by logging in or Working off
  8. #                line.                
  9. #
  10. #    Conventions:    Global variables begin with a capital letter
  11. #
  12. #    Written by:    P Nagarajan
  13. #
  14. #    Copyright:    © 1990 by Apple Computer, Inc., all rights reserved.
  15. #
  16. #    Change History:
  17. #
  18. #        2/21/90       naga         creation 
  19. #
  20.  
  21.  
  22. ####
  23. # First make sure if the target is configured right
  24. match[application t:?app_name]!;
  25. if not (app_name ~= /AppleLink≈/) 
  26. begin
  27.     println "This script will requires Apple Link to be the frontmost application";
  28.     exit;
  29. end; #check if Apple Link is running
  30.  
  31. if not (match [menuItem t:'Help' e:true m:[menu o:1]]!)
  32. begin
  33.     println "Your Apple Link does not have Help installed";
  34.     println "Please try installing Help file into AppleLink folder and try again";
  35.     exit;
  36. end;# check if Help menuitem is enabled
  37.  
  38. if (match [window s:dialog o:1]!)
  39. begin
  40.     if (match[button t:'Work off line' w:[window o:1]]!)
  41.         select [button t:'Work off line' w:[window o:1]]!;
  42.     else 
  43.     begin
  44.         println "Sorry cannot get rid of the dialog";
  45.         exit;
  46.     end;
  47. end; #Check if there is a dialog up on the front(maybe Connect/Login dialog)
  48.  
  49. ####
  50. # Now do some menu item selections
  51. select [menuItem t:'Saving' 
  52.                  m:[menuItem t:'Working With Memos' 
  53.                               m:[menuItem t:'Help' m:[menu o:1]]]]!;
  54.  
  55. ####
  56. # The following two statements will also work but are not as efficient
  57. select [menuItem t:'Saving' 
  58.                  m:[menuItem t:'Working With Memos']]!;
  59.  
  60. select [menuItem t:'Saving']!; 
  61.  
  62. ####
  63. # Now some matching:
  64. match [menuItem t:?item_title 
  65.                 h:{ [menuItem t:'Introduction'],
  66.                     [menuItem t:'Using the personal menu']}]!;
  67.  
  68. # This match takes a lot of time, since there are a lot of submenus and a lot
  69. # of item in each. Hence avoid giving the 'h:' trait if possible in your scripts.
  70. # Here we used it as an illustration of its utility.
  71.  
  72. println item_title;